package ar.edu.uba.fi.jmit.monitorengine.backend.server;

import java.util.LinkedList;
import java.util.List;

import ar.edu.uba.fi.jmit.monitorengine.backend.client.EventService;
import ar.edu.uba.fi.jmit.monitorengine.backend.shared.dto.EventDTO;
import ar.edu.uba.fi.jmit.monitorengine.core.EventServiceManager;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class EventServiceImpl extends RemoteServiceServlet implements EventService{

	private static final long serialVersionUID = 3674154333225185450L;

	@Override
	public List<EventDTO> getLastRecivedEvents(int from, int to) {
		return new LinkedList<EventDTO>(EventServiceManager.getInstance().getRangeEventDTOs(from, to));
	}

	@Override
	public long getReceivedEventsCount() {
		return EventServiceManager.getInstance().getCountEventDTOs();
	}

}
